package mvc.model.dao.impl;

import mvc.common.BaseDao;
import mvc.model.dao.RomDao;
import mvc.model.pojos.RomBean;

import java.util.List;

public class RomDaoImpl implements RomDao {
    private static BaseDao baseDao = new BaseDao();
    @Override
    public List<RomBean> queryR(int rsize) {
        String sql = "select * from rom where rsize = ?";
        return baseDao.query(sql, RomBean.class, rsize);
    }

    @Override
    public List<RomBean> queryM(int msize) {
        String sql = "select * from rom where msize = ?";
        return baseDao.query(sql, RomBean.class, msize);
    }

    @Override
    public RomBean query(int rid) {
        String sql = "select * from rom where rid = ?";
        List<RomBean> query = baseDao.query(sql, RomBean.class, rid);
        return query.isEmpty() ? null : query.get(0);
    }
}
